package com.phenix.mvp.base.multitype;

import android.content.Context;
import android.support.annotation.NonNull;

import java.util.ArrayList;
import java.util.Map;

/**
 * @author  zhouphenix on 2017-1-8.
 */

public class GlobalMultiTypePool {

    private static MultiTypePool mPool = new MultiTypePool();

    public static void register(@NonNull Context context, @NonNull Class<? extends BaseViewHolder>... clazzs){
        mPool.register(context, clazzs);
    }

    public static void unregister(@NonNull Class<? extends BaseViewHolder> clazz){
        mPool.unregister(clazz);
    }

    public static int indexOf(@NonNull Class<?> clazz){
        return mPool.indexOf(clazz);
    }

    public static Class<? extends BaseViewHolder> getViewHolderByType(int type){
        return mPool.getViewHolderByType(type);
    }

    public static Class<? extends BaseViewHolder> getBaseViewHolderByClass(Class<?> itemClass) {
        return mPool.getViewHolderByClass(itemClass);
    }

    public static ArrayList<Class<? extends BaseViewHolder>> getViewHolders(){ return mPool.getViewHolders();}

    public static void setTag(@NonNull Class<? extends BaseViewHolder> clazz, Map<Integer, Object> tags) {
        mPool.setTag(clazz, tags);
    }

    public static Map<Integer, Object> getTag(@NonNull Class<? extends BaseViewHolder> clazz) {
        return (Map<Integer, Object>) mPool.getTag(clazz);
    }

}
